-- 创建 CameraController 表
local CameraController = BaseClass(Singleton)

function CameraController:__init()
    self.zoomSpeed = 10.0
    self.minFOV = 30.0
    self.maxFOV = 100.0
    --GameObject.FindWithTag("MainCamera"):GetComponent(typeof(Camera))

end

function CameraController:Update()
    
    local scroll = UnityEngine.Input.GetAxis("Mouse ScrollWheel")
    -- if self.camera~=nil then
    --     self.camera =Camera.main
    -- end
    
    if scroll ~= 0  then 
         -- 调整FOV：滚轮向上减小FOV（放大），向下增加FOV（缩小）
        local newFOV = Camera.main.fieldOfView - scroll * self.zoomSpeed
        newFOV = UnityEngine.Mathf.Clamp (newFOV, self.minFOV, self.maxFOV)
        Camera.main.fieldOfView = newFOV
    end
end

return CameraController